#pragma once
#include<iostream>
#include<arpa/inet.h>

class InetAddress
{
private:
    sockaddr_in _serv_addr;
public:
    InetAddress()=default;
    InetAddress(std::string ip, int port);
    ~InetAddress();
    sockaddr_in &serv_addr() {
        return _serv_addr;
    }
};

InetAddress::InetAddress(std::string ip, int port)
{
    _serv_addr.sin_family = AF_INET;
    _serv_addr.sin_addr.s_addr = inet_addr(ip.c_str());
    _serv_addr.sin_port = htons(port);
}

InetAddress::~InetAddress()
{
}
